package com.example.fang.demodruid.aspect;


import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 记录接口请求时间
 */
@Aspect
@Component
@Slf4j
public class CountTimesAspect {


    // 配置织入点
    @Pointcut("@annotation(com.example.fang.demodruid.annotation.CountTimesAnnotation)")
    public void ponitCut() {
    }

    @Around("ponitCut()")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("注解类型环绕通知..环绕前");
        Object object = pjp.proceed();
        System.out.println("注解类型环绕通知..环绕后");
        return  object;
    }

}
